/**
 * 限制条件 extends
 * */

function longest<T extends { length: number }>(a: T, b: T) {
  if (a.length >= b.length) {
    return a
  } else {
    return b
  }
}

const longerArray = longest([1, 2], [2, 3, 5])
const longerString = longest('felix', 'lu')
// const notok = longest(12, 122)

console.log(longerArray, longerString)